<template>
  <div id="app1">
    <img alt="Vue logo" src="./assets/logo.png">
    <!-- <HelloWorld msg="Welcome to Your Vue.js App"/> -->
    <div>
      <button @click="linkTarget('myTest')">名称：JS测试页面1</button>
      <button @click="linkTarget2()">名称：JS测试页面2</button>

      <button @click="linkTarget('/test')">路径：JS测试页面1</button>
      <button @click="linkTarget2()">路径：JS测试页面2</button>

      <router-link to="/test2/v2/key2">测试页面2</router-link>
      <router-link to="/test?name=张三">测试页面1</router-link>
    </div>
    <router-view></router-view>
  </div>
</template> 

<script>
// import HelloWorld from './components/HelloWorld.vue'



export default {
  name: 'App',
  components: {
    // HelloWorld
  },
  data(){
    return {
      v22: 'v22'
    }
  },
  methods: {
    linkTarget(path) {
      // this.$router.push({name: path, query:{key: 'v22'}})
      this.$router.push({path: path, query:{key: 'v22'}})
    },
    linkTarget2() {
      // this.$router.push({name: `myTest2`, params:{key: 'v22'}})
      this.$router.push({path: `/test2/${this.v22}/key2`, params:{key: 'v22'}})
    }
  }
}
</script>

<style>
#app1 {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.router-link-active{
  color: red;
}
.link-active{
  color: red;
}
</style>
